package com.zjitc.controller;

import com.zjitc.model.Category;
import com.zjitc.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * Create by IntelliJ IDEA
 *
 * @author: lhl
 * @date-Time: 2018/4/5 0005
 * @description:
 */
@Controller
@RequestMapping(value = "/category")
public class CategoryControl {

    @Autowired
    private CategoryService categoryService;

    @RequestMapping(value = "/findAllCategory")
    @ResponseBody
    public List<Category> findAll(HttpServletResponse response) throws IOException {
        List<Category> all = categoryService.findAll();
        System.out.println(all);
        return all;
    }

}
